package com.Tokiu.Service;

import com.Tokiu.Dao.BaoDao;
import com.Tokiu.Dao.BaoDaoInter;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;


//继承实现初始化实现方法，以及销毁程序前的文件方法
@Service
public class BaoService implements BaoInter, InitializingBean, DisposableBean {
    @Autowired
    private BaoDaoInter service;

    public void add() {
        System.out.println("Service add ....");
        service.save();
    }

    public void setService(BaoDaoInter service) {
        this.service = service;
    }

    public void destroy() throws Exception {
        System.out.println("Service destroy....");
    }

    public void afterPropertiesSet() throws Exception {
        System.out.println("Service init....");
    }
}
